import { apiGo } from "./request.js";
// import util from "@/utils/util";
import { useUserStore } from "@/stores";

// 登录
export function login(params = {}) {
  return apiGo.post(`/common/login`, params);
}

// 用户信息
export async function getUserInfo() {
  if (!localStorage.getItem("token")) return;
  const userinfo = await apiGo.get(`/site/user_info`);
  useUserStore().update(userinfo);
  return userinfo;
}
